/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package migreme;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URLEncoder;
import java.util.logging.Level;
import java.util.logging.Logger;
import migreme.http.URLRequest;
import migreme.http.URLRequestMethod;


/**
 *
 * @author pavei
 */
public class HttpMigreMe {

    String urlPadrao = "http://migre.me/";
    public static String XML ="xml";

    public String getContent(String valor){

      return getContent(XML, valor);

    }

    private String  getContent(String format, String valor){

    URLRequest o = null;
    String val = "";
        try {
           o = new URLRequest(mountUrl(format, valor), URLRequestMethod.POST);
            val = o.getResponse();
        } catch (MalformedURLException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
   
       return val;
  }

  private String mountUrl(String format, String content){
      String urlEncode = content;

      return urlPadrao+"api."+format+"?url="+urlEncode;

  }







}
